<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWechatUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wechat_users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('w_id');
            $table->string('nick_name');
            $table->string('student_id')->nullable();
            $table->string('sex')->nullable();
            $table->string('city')->nullable();
            $table->string('country')->nullable();
            $table->string('province')->nullable();
            $table->string('headimgurl')->nullable();
            $table->string('open_id');
            $table->string('subscribe_time');
            $table->string('remark')->nullable();
            $table->string('groupid')->nullable();
            $table->string('tagid_list')->nullable();
            $table->softDeletes();
            $table->timestamps();
        });

        Schema::table('wechat_messages', function (Blueprint $table) {
            $table->integer('is_return')->default(0)->nullable();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wechat_users');
        Schema::dropIfExists('wechat_user_relations');
        Schema::table('wechat_messages', function (Blueprint $table) {
          //  $table->integer('is_return')->default(0)->nullable();
            Schema::dropIfExists('is_return');
        });
    }
}
